/**
 * AnalyzeErrorsBase.java
 *
 * Copyright (c) Viorel Tacliciu 2009. All Rights Reserved.
 *
 * This source file may not be copied, modified or redistributed,
 * in whole or in part, in any form or for any reason, without the express
 * written consent of Viorel Tacliciu. 
 **/
package ro.prjmanager.architecture;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.util.StopWatch;

@Aspect
public class PrjManagerSystemArchitecture {
    @Around("execution(* ro.prjmanager.service.*.*(..))")
    public Object doBasicProfiling(ProceedingJoinPoint pjp) throws Throwable {
        StopWatch sw = new StopWatch(pjp.getTarget().getClass().getName());
        try {
            sw.start(pjp.getSignature().getName());
            return pjp.proceed();
        } finally {
            sw.stop();

            System.out.println(sw.prettyPrint());
        }

    }


}
